// 通用的js

function formatDate(date, format = 'yyyy-MM-dd hh:mm:ss') {
  console.log('参数信息：', date, format);
  let now = new Date();
  now = date;

  // 获取年月日时分秒的信息
  let y = now.getFullYear();
  let m = now.getMonth() + 1;
  let d = now.getDate();
  let h = now.getHours();
  let mm = now.getMinutes();
  let s = now.getSeconds();
  // 替换格式化字符串的内容为对应的时间信息
  let result = format.replace(/yyyy/g, y);
  result = result.replace(/MM/g, m);
  result = result.replace(/dd/g, d);
  result = result.replace(/hh/g, h);
  result = result.replace(/mm/g, mm);
  result = result.replace(/ss/g, s);

  return result;
}